<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<style>
    /* 
        浮动问题出现的场景
        浮动元素会脱标，如果父级元素没有设置高度，子级由于浮动了，没法撑开父级的高度。导致下面的盒子上去了，打乱了布局
    */
    * {
        margin: 0;
        padding: 0;
    }

    .box1 {
        margin: 100px auto;
        width: 900px;
        /* height: 500px; */
        background-color: aqua;
    }

    .box2 {
        width: 400px;
        height: 400px;
        background-color: yellow;
        float: left;
    }

    .box3 {
        width: 400px;
        height: 400px;
        background-color: orange;
        float: right;
    }

    .box4 {
        height: 100px;
        background-color: black;
    }
</style>

<body>
    <div class="box1">
        <div class="box2"></div>
        <div class="box3"></div>
    </div>
    <div class="box4"></div>
</body>

</html>